{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "%matplotlib inline\n",
    "plt.rcParams[\"font.sans-serif\"] = [\"SimHei\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib as mpl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def scatter_with_cmap(cmap):\n",
    "    x = np.arange(1,13,1)\n",
    "    y = np.random.randint(1,16,size=12)\n",
    "    labels = [\"Python\",\"Java\",\"C++\",\"C\",\"SQL\",\"JS\",\"Go\",\"HTML\",\"R\",\"C#\",\"CSS\",\"TypeScript\"]\n",
    "    \n",
    "    fig = plt.figure(figsize=(10,5),dpi=100)\n",
    "    ax =  fig.add_subplot(1,1,1)\n",
    "    ax.xaxis.set_ticks(x)\n",
    "    ax.xaxis.set_ticklabels(labels,family=\"fantasy\")\n",
    "    ax.set_title(\"团队熟悉某语言的开发者数量分布\")\n",
    "    \n",
    "    dot = ax.scatter(x,y,s=500,c=y,cmap=cmap)\n",
    "    fig.colorbar(dot,ax=ax)\n",
    "\n",
    "# 选择一种内置颜色映射“cool”\n",
    "cool = mpl.cm.cool\n",
    "scatter_with_cmap(cmap)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
